#include<stdio.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<unistd.h>
#include<arpa/inet.h>
#include<sys/select.h>
#include<mysql.h>
#include<string.h>

void exit(int connectfd)
{
	MYSQL mysql;
    	char mysql_insert[100];
    	int rc,nflag=-1;
    	if(NULL == mysql_init(&mysql)) 
	{  
	        printf("mysql_init(): %s\n", mysql_error(&mysql));  
        	return ;  
    	}  
    	if (NULL == mysql_real_connect(&mysql,  
			"localhost",  
                	"root",  
                	"root",  
                	"lts",  
                	 0,  
                	NULL,  
                	0)) 
	{  
        	printf("mysql_real_connect(): %s\n", mysql_error(&mysql));  
        	return ;  
    	}
	sprintf(mysql_insert,"update user set fd = 0 where fd = %d",connectfd);
	if(mysql_query(&mysql,mysql_insert))
    	{
		fprintf(stderr,"%s\n",mysql_error(&mysql));
    	}  
	mysql_close(&mysql); 
}
